import React , { useState , useCallback } from "react";
import Header from './Header';
import List from "./List";
import Input from "./Input";
import Options from "./Options";
import AppProvider from "./Context";

const initState = {
    done:false,
    id:Date.now(),
    titlr:""
};

const reducer = (state,action) => {
    switch (action.type) {
        case "1":
            
            break;
    
        default:
            break;
    }
}


const App = () => {
    const [list,setList] = useState([]);
    
    //用来缓存一个函数
    const add = useCallback((title) => {
        setList((list) => [{done:false,id:Date.now(),title},...list])
    },[]);

    return <AppProvider>
        <Header />
        <Input />
        <List />
        <Options list={list}/>
    </AppProvider>
}

export default App;